home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / xulrunner / python / xpcom / register.py < prev    next >
Encoding:
Python Source  |  2007-11-12  |  3.0 KB  |  72 lines

  1.  
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. #
  5. # The contents of this file are subject to the Mozilla Public License Version
  6. # 1.1 (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. # http://www.mozilla.org/MPL/
  9. #
  10. # Software distributed under the License is distributed on an "AS IS" basis,
  11. # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. # for the specific language governing rights and limitations under the
  13. # License.
  14. #
  15. # The Original Code is the Python XPCOM language bindings.
  16. #
  17. # The Initial Developer of the Original Code is ActiveState Tool Corp.
  18. # Portions created by ActiveState Tool Corp. are Copyright (C) 2000, 2001
  19. # ActiveState Tool Corp.  All Rights Reserved.
  20. #
  21. # Contributor(s):
  22. #   Mark Hammond <MarkH@ActiveState.com> (original author)
  23. #
  24. # Alternatively, the contents of this file may be used under the terms of
  25. # either the GNU General Public License Version 2 or later (the "GPL"), or
  26. # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. # in which case the provisions of the GPL or the LGPL are applicable instead
  28. # of those above. If you wish to allow use of your version of this file only
  29. # under the terms of either the GPL or the LGPL, and not to allow others to
  30. # use your version of this file under the terms of the MPL, indicate your
  31. # decision by deleting the provisions above and replace them with the notice
  32. # and other provisions required by the GPL or the LGPL. If you do not delete
  33. # the provisions above, a recipient may use your version of this file under
  34. # the terms of any one of the MPL, the GPL or the LGPL.
  35. #
  36. # ***** END LICENSE BLOCK *****
  37.  
  38. import os, sys
  39.  
  40. def addSelf(fname):
  41.     #XXX the path hardcoding and env var reliance limits the usefulness
  42.     #XXX I don't even know if this is used, or usable, at all anymore.
  43.     try:
  44.         mozSrc = os.environ['MOZ_SRC']
  45.     except KeyError:
  46.         print "register.py: need MOZ_SRC to be set"
  47.         sys.exit(-1)
  48.     try:
  49.         komododist = os.environ['KOMODO']
  50.     except KeyError:
  51.         print "Set KOMODO"
  52.         sys.exit(-1)
  53.  
  54.     bindir = os.path.join(mozSrc, "dist", "WIN32_D.OBJ", "bin")
  55.     idldir = os.path.join(mozSrc, "dist", "idl")
  56.     idl2dir = os.path.join(komododist, "SciMoz")
  57.     componentdir = os.path.normpath(os.path.join(bindir, 'components'))
  58.  
  59.     base, ext = os.path.splitext(fname)
  60.     idlfile = base+'.idl'
  61.     pyfile = base+'.py'
  62.     xptfile = base+'.xpt'
  63.     if os.path.exists(idlfile):
  64.         # IDL file of same name exists, assume it needs to be updated
  65.         print r'%(bindir)s\xpidl -I %(idldir)s -I %(idl2dir)s -m typelib %(idlfile)s' % vars()
  66.         os.system(r'%(bindir)s\xpidl -I %(idldir)s -I %(idl2dir)s -m typelib %(idlfile)s' % vars())
  67.     print r'cp %(xptfile)s %(componentdir)s' % vars()
  68.     os.system(r'cp %(xptfile)s %(componentdir)s' % vars())
  69.     print 'cp %(pyfile)s %(componentdir)s' % vars()
  70.     os.system('cp %(pyfile)s %(componentdir)s' % vars())
  71.         
  72.